Lines


Problem 1
Create an Open GL application called Lines to test lines in Open GL.
Cree una aplicación de Open GL llamada Lines para probar las líneas en Open GL.

LinesRun

Lines.cpp
...
bool Lines::RenderScene()
{
     //______________________________________________________ Line
     static float lineWidth = 0.0f;
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// clear screen and depth buffer
     glLoadIdentity();
     gluLookAt(0.0, 10.0, 0.1, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
     glLineWidth(lineWidth);
     glColor3f(1.0f, 0.0f, 0.0f); // Red, Green , blue
     glBegin(GL_LINES);
          glVertex3f(-5.0f, 0.0f, 0.0f); // Point 1 (x, y, z)
          glVertex3f(-1.0, 0.0f, 0.0f); // Point 2 (x, y, z)
     glEnd();
     lineWidth += 0.1f;
     if (lineWidth>10.0f) lineWidth = 0.0f;

     return true; // return false to stop
}

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home